Skip to content

Conversation

kylesayrs
Copy link
Collaborator

Purpose

  • Fix failing nightly training tests
2025-10-01T16:00:34.3410069Z FAILED tests/llmcompressor/transformers/finetune/test_finetune_no_recipe_custom_dataset.py::test_oneshot_then_finetune_gpu[config0] - AttributeError: 'Trainer' object has no attribute 'tokenizer'
2025-10-01T16:00:34.3411515Z FAILED tests/llmcompressor/transformers/finetune/test_finetune_without_recipe.py::test_finetune_without_recipe[config0] - AttributeError: 'Trainer' object has no attribute 'tokenizer'
2025-10-01T16:00:34.3412858Z FAILED tests/llmcompressor/transformers/finetune/test_oneshot_and_finetune.py::test_oneshot_and_finetune_gpu[config0] - AttributeError: 'Trainer' object has no attribute 'tokenizer'
2025-10-01T16:00:34.3414275Z FAILED tests/llmcompressor/transformers/finetune/test_oneshot_and_finetune_with_tokenizer.py::test_oneshot_and_finetune_with_tokenizer[config0] - AttributeError: 'Trainer' object has no attribute 'tokenizer'
2025-10-01T16:00:34.3415633Z FAILED tests/llmcompressor/transformers/finetune/test_safetensors.py::test_safetensors[config0] - AttributeError: 'Trainer' object has no attribute 'tokenizer'

Changes

  • Do not attempt to use Trainer.tokenizer, which has be removed for a long time now

Testing

  • Failing tests pass now

Copy link

github-actions bot commented Oct 1, 2025

👋 Hi! Thank you for contributing to llm-compressor. Please add the ready label when the PR is ready for review.

Note: This is required to complete the testing suite, please only add the label once the PR is code complete and local testing has been performed.

Copy link
Contributor

Summary of Changes

Hello @kylesayrs, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses critical failures in nightly training tests by updating how the processor is accessed during model saving. It removes a dependency on a deprecated tokenizer attribute within the Trainer object, ensuring the training pipeline functions correctly and tests pass as expected.

Highlights

  • Fix AttributeError in training tests: This pull request resolves nightly training test failures caused by an AttributeError related to the tokenizer attribute on Trainer objects, which no longer exists in the current transformers library versions.
  • Update model saving logic: The save_model method within SessionMixin has been updated to directly use self.processing_class when determining the processor for saving checkpoints, removing the reliance on the deprecated self.tokenizer attribute.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@kylesayrs kylesayrs added the ready When a PR is ready for review label Oct 1, 2025
Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request addresses a crash in training tests by removing a dependency on the tokenizer attribute, which is no longer reliably present on the Trainer object. The fix is correct in principle. However, my review identifies a potential issue in the implementation: the new code directly accesses self.processing_class, which appears to be a typo for self.processor and could cause a new AttributeError if the attribute is missing. I've provided a suggestion to make the code more robust by using getattr for safe access, which will prevent crashes and align with how the save_checkpoint function is designed to be used.

output_dir,
model=self.model,
processor=processor,
processor=self.processing_class,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This direct access to self.processing_class could be brittle and may raise an AttributeError if the attribute doesn't exist. It seems processing_class is a typo for processor, which is a standard attribute on the transformers.Trainer.

To make this more robust, I recommend using getattr to safely access self.processor. The save_checkpoint function correctly handles cases where the processor is None.

Suggested change
processor=self.processing_class,
processor=getattr(self, "processor", None),

@kylesayrs kylesayrs marked this pull request as draft October 1, 2025 21:26
@kylesayrs
Copy link
Collaborator Author

Blocking until release finishes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready When a PR is ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant